﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;
namespace GUI
{
    public partial class TraCuuDiaDiemThamQuan_KhachSanTheoTuyen : Form
    {
        public TraCuuDiaDiemThamQuan_KhachSanTheoTuyen()
        {
            InitializeComponent();
        }
        public void Showmaster()
        {
            int MaTuyenDL = int.Parse(cbTenTuyen.SelectedValue.ToString());
            this.dgvDanhSach.AutoGenerateColumns = true;
            this.dgvDanhSach.DataSource = DIADIEMTHAMQUAN_THANHPHO_BUS.SelectDDTQsByAndMaTuyen(MaTuyenDL);
            this.dataGridView1.AutoGenerateColumns = true;
            this.dataGridView1.DataSource = KHACHSAN_THANHPHO_BUS.SelectKSsByAndMaTuyen(MaTuyenDL);
        
        }
        private void cbTenTuyen_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbTenTuyen.ValueMember = "MaTuyenDL";
            //cbTenTuyen.DisplayMember = "TenTuyenDL";
            Showmaster();
        }

        private void TraCuuDiaDiemThamQuan_KhachSanTheoTuyen_Load(object sender, EventArgs e)
        {
            cbTenTuyen.DataSource = TUYENDL_BUS.SelectTuyenDuLichsAll();
            cbTenTuyen.ValueMember = "MaTuyenDL";
            cbTenTuyen.DisplayMember = "TenTuyenDL";
            Showmaster();
        }

        private void dgvDanhSach_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
        }

        private void btTimKiem_Click(object sender, EventArgs e)
        {
            cbTenTuyen.ValueMember = "MaTuyenDL";
            //cbTenTuyen.DisplayMember = "TenTuyenDL";
            Showmaster();
        }

        private void btThoát_Click(object sender, EventArgs e)
        {

            DialogResult dr = MessageBox.Show("Bạn Thật Sự Muốn Thoát?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (dr == DialogResult.Yes)
            {
                this.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

            DialogResult dr = MessageBox.Show("Bạn Thật Sự Muốn Thoát?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (dr == DialogResult.Yes)
            {
                this.Close();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            cbTenTuyen.ValueMember = "MaTuyenDL";
            //cbTenTuyen.DisplayMember = "TenTuyenDL";
            Showmaster();
        }
    }
}
